<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCouponPackage extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupon_package', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('brandId')->comment('品牌id')->default(0);
            $table->unsignedTinyInteger('status')->comment('券包状态 0 - 正常 1 - 禁用')->default(0);
            $table->unsignedTinyInteger('shopType')->comment('店铺类型 0-全部，1-加盟，2-直营，3-部分选择')->default(0);
            $table->string('name', 50)->comment('券包名称')->default('');
            $table->unsignedInteger('startAt')->default(0)->comment('起始售卖时间');
            $table->unsignedInteger('endAt')->default(0)->comment('截止售卖时间');
            $table->unsignedInteger('salePrice')->default(0)->comment('售价 （分）');
            $table->unsignedInteger('dayStartAt')->default(0)->comment('每日弹窗起始时间');
            $table->unsignedInteger('dayEndAt')->default(0)->comment('每日弹窗截止时间');
            $table->unsignedInteger('canSaleCount')->default(0)->comment('可售卖数量');
            $table->unsignedInteger('hasSaleCount')->default(0)->comment('已售数量');
            $table->string('couponPackageImg', 120)->default('')->comment('券包封面图');
            $table->unsignedTinyInteger('miniAdvPopSwitch')->default(0)->comment('小程序弹窗广告开关 0 - 关闭 1 - 启用');
            $table->string('miniAdvPopImg', 120)->default('')->comment('小程序弹窗图片');
            $table->text('collectMoneyCopy')->default('')->comment('收银页文案');
            $table->text('publicityCopy')->default('')->comment('弹窗宣传文案');
            $table->text('noticeOfPurchase')->default('')->comment('购买须知');
            $table->text('noticeOfPurchaseDetail')->default('')->comment('购买须知详情');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");
            $table->index("brandId", "idx_brandId");
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '优惠券包表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupon_package');
    }
}
